package wk.coral.jar;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import wk.coral.core.RunJar;
import wk.coral.entity.config.PropertiesConfigEntity;
import wk.coral.jar.config.ApplicationContextConfig;
import wk.coral.jar.config.PropertiesConfig;
import wk.coral.util.applicationContext.ApplicationContextUtil;
import wk.coral.util.bean.BeanUtil;

/**
 * description:
 * date 2021-01-16 14:26
 *
 * @author Administrator
 * @version 1.0
 */
@Slf4j
public class GenerateJar {

    static {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(ApplicationContextConfig.class);
    }

    public static void main(String[] args) {
        try {
            PropertiesConfig propertiesConfig = ApplicationContextUtil.getBean(PropertiesConfig.class);
            PropertiesConfigEntity propertiesConfigEntity = BeanUtil.bean2Bean(PropertiesConfigEntity.class, propertiesConfig);
            RunJar.getInstance().run(propertiesConfigEntity);
        } catch (Exception e) {
            log.error("runJar faild {}",e.getMessage(), e);
        }
    }
}
